﻿<%@ Page Debug="true" Title="Bài viết mới" Language="C#" MasterPageFile="~/Manager.Master" ValidateRequest="true" AutoEventWireup="true" CodeBehind="AddNews.aspx.cs" Inherits="Manager.AddNews" %>

<%@ Register Assembly="CKFinder" Namespace="CKFinder" TagPrefix="CKFinder" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <script type="text/javascript">

      function BrowseServer() {
          // You can use the "CKFinder" class to render CKFinder in a page:
          var finder = new CKFinder();
          finder.basePath = '../'; // The path for the installation of CKFinder (default = "/ckfinder/").
          finder.selectActionFunction = SetFileField;
          finder.popup();

          // It can also be done in a single line, calling the "static"
          // popup( basePath, width, height, selectFunction ) function:
          // CKFinder.popup( '../', null, null, SetFileField ) ;
          //
          // The "popup" function can also accept an object as the only argument.
          // CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
      }

      // This is a sample function which is called when a file is selected in CKFinder.
      function SetFileField(fileUrl) {
          document.getElementById('contentPage_hiddenImg').value = fileUrl;
          document.getElementById('thumbnails').innerHTML +=
			'<div>' +
				'<img src="' + fileUrl + '" style="width: 60px; height: 60px;" />' +
			'</div>';

          document.getElementById('preview').style.display = "";
          document.getElementById('image').style.display = "none";
      }

    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="contentPage" runat="server">
    <div class="breadcrumb">
 <a href="Default.aspx">Trang quản trị</a> >> <a href="NewsManager.aspx">Quản lý Bài viết</a> >> <a href="AddNews.aspx">Bài viết mới</a>
</div>

    <div class="box" style="float:left; width: 100%">
        <div class="heading">
            <h1><img src="Styles/Img/order.png" alt="" />Bài viết mới</h1>            
        </div>

        <div class="content" style="text-align: center;">
                           <br />
            <table class="update" border="0" cellspacing="10" cellpadding="10" width="880">
                <tbody>                
                <tr class="filter"><td colspan="2">&nbsp;</td></tr>
                <tr>
                    <td colspan="2" class="center">
                        <span class="required">
                            <asp:Label ID="lblMessage" runat="server" Text="" Visible="false"></asp:Label></span>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px; text-align: left;">
                        <span class="required">*</span> Tiêu đề: 
                    </td>
                    <td style="text-align: left;">
                        <asp:TextBox ID="txtNewsTitle" runat="server" Width="350px"></asp:TextBox><br />                                
                    </td>
                </tr>         
                <tr>
                    <td style="width: 200px; text-align: left;">
                        <span class="required"></span> Ảnh: 
                    </td>
                    <td style="text-align: left;"><br />
                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                	<tr>
                                		<td style="text-align: center; border-right: 0px; width: 90px;">
	                                    <div id="preview" style="display: none;">
		                                    <div id="thumbnails"></div>
	                                    </div>
                                        <div style="text-align: center;" id="image">
                                            <asp:Image ID="imgThumb" runat="server" Width="60px" Height="60px" />
                                        </div>
                                            <br />
                                            <asp:LinkButton ID="lblDel" runat="server" onclick="lblDel_Click">Xóa</asp:LinkButton>
                                        </td>
                                        <td style="text-align: left; border-left: 0px;">
                                            <input id="btnSelectImg" type="button" value="Chọn ảnh" class="button" onclick="BrowseServer();" />
                                            <asp:HiddenField ID="hiddenImg" runat="server" />  
                                        </td>
                                	</tr>
                                </table>        
                            </td>
                </tr>  
                <tr>
                    <td style="width: 200px; text-align: left;"> Ngày đăng: </td>
                    <td style="text-align: left;"><asp:Label ID="lblDatePosted" Text="" Font-Italic="true" runat="server"></asp:Label></td>
                </tr>
                <tr>
                    <td style="width: 200px; text-align: left;">
                        <span class="required">*</span> Trạng thái: 
                    </td>
                    <td style="text-align: left;">
                        <asp:RadioButton ID="rbtActive" Text="Hoạt động" Checked="true" GroupName="grStatus" runat="server" />
                        <asp:RadioButton ID="rbtDeactive" Text="Tạm khóa" GroupName="grStatus" runat="server" />
                        <br />                                
                    </td>
                </tr> 
                <tr>
                    <td style="width: 200px; text-align: left;">  Mô tả sơ lược:</td>
                    <td style="text-align: left;"><br />                        
                        <asp:TextBox ID="txtDes" TextMode="MultiLine" Width="360" Height="80" runat="server" Wrap="True"></asp:TextBox>
                            <br /><br />
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px; text-align: left;">  Bài viết chi tiết:</td>
                   <td style="text-align: left;"><br />
                       <CKEditor:CKEditorControl ID="editorContent" Width="680px" Height="180px" runat="server"></CKEditor:CKEditorControl>
                            <br />
                    </td>
                </tr>
                <tr>                    
                    <td colspan="2" align="center">
                    <br />
                        <asp:Button ID="btnAdd" runat="server" CssClass="button" Text="Đăng" 
                            onclick="btnAdd_Click" />
                        <asp:Button ID="btnClose" runat="server" CssClass="button" Text="Thoát" />
                    <br />
                    <br />
                    </td>
                </tr>      
                <tr class="filter"><td colspan="2">&nbsp;</td></tr>
                </tbody>
            </table>
            
        </div>
    </div>
</asp:Content>
